# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=lilv
pkgver=0.24.24
pkgrel=1
pkgdesc="C library for simpler use of LV2 plugins"
url="https://drobilla.net/software/lilv"
arch="all"
license="ISC"
makedepends="
	libsndfile-dev
	lv2-dev
	meson
	serd-dev
	sord-dev
	sratom-dev
	"
subpackages="
	$pkgname-dev
	$pkgname-libs
	py3-$pkgname-pyc
	py3-$pkgname:py3:noarch
	$pkgname-doc
	$pkgname-bash-completion
	"
source="https://download.drobilla.net/lilv-$pkgver.tar.xz
	python-lib.patch
	"

build() {
	abuild-meson -Db_lto=true . output
	meson compile -C output
}

check() {
	meson test --print-errorlogs --no-rebuild -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	mkdir -p "$pkgdir"/usr/share/bash-completion/completions
	mv "$pkgdir"/etc/bash_completion.d/lilv \
		"$pkgdir"/usr/share/bash-completion/completions/
	rmdir "$pkgdir"/etc/bash_completion.d
	python3 -m compileall -fq "$pkgdir"/usr/lib/python*
}

py3() {
	pkgdesc="$pkgdesc (python module)"
	depends="$pkgname-libs=$pkgver-r$pkgrel"
	amove usr/lib/python*
}

sha512sums="
93a3842a5e000a9c59bf3493c2c10df35a803a7edf6cff09f43e155a7e83d0c7c81bc24a6243828dc141d30187c3f60ef9799f319f72e5b6c3e2d022de757185  lilv-0.24.24.tar.xz
59ad0b3129ebc6042d168a44276ccd121fd19c1a314a65d7594629f6733f96ebfa270dfcf828084f05001f05e6dd92cfa6079aa1e2eddcbcc1a2ecb48120e8ad  python-lib.patch
"
